//
//  MapLocalTableViewCell.m
//  Findif
//
//  Created by Cicel Chen on 2018/10/26.
//  Copyright © 2018年 Cicel Chen. All rights reserved.
//

#import "MapLocalTableViewCell.h"

@interface MapLocalTableViewCell ()

@property (nonatomic, weak)UILabel * nameLabel;
@property (nonatomic, weak)UILabel * adressLabel;
@property (nonatomic, weak)UIView * lineView;

@end

@implementation MapLocalTableViewCell


//- (void)setModel:(MapLocalModel *)model{
//    
//    _model = model;
//    
//    self.titleLabel.text = model.name;
//    self.subLabel.text = model.address;
//}

- (void)setName:(NSString *)name{

    _name = name;

    self.nameLabel.text = name;
}


- (void)setAddrss:(NSString *)addrss{

    _addrss = addrss;

    self.adressLabel.text = addrss;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self setupUI];
    }
    
    return self;
}


- (void)setupUI{
    
    self.backgroundColor = ZRWhiteColor;
    
    UILabel * nameLabel = [UILabel new];
    
    nameLabel.textColor = ZRBlackColor;
    nameLabel.font = [UIFont systemFontOfSize:16 * SCREENH6];
//    nameLabel.text = @"aaaaaaaaa";
    
    self.nameLabel = nameLabel;
    
    [self.contentView addSubview:self.nameLabel];
    
    
    UILabel * adressLabel = [UILabel new];
    
    adressLabel.textColor = [UIColor lightGrayColor];
    adressLabel.font = [UIFont systemFontOfSize:14 * SCREENH6];
//    adressLabel.text = @"bbbbbbbbbb";
    
    
    self.adressLabel = adressLabel;
    
    [self.contentView addSubview:self.adressLabel];
    
    UIView * lineView = [UIView new];
    
    lineView.backgroundColor = ColorWithRGB(0xe4e4e4);
    
    self.lineView = lineView;
    
    [self.contentView addSubview:self.lineView];
}

- (void)layoutSubviews{
    
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(self.contentView).offset(15 * SCREENH6);
        make.trailing.mas_equalTo(self.contentView).offset(-15 * SCREENH6);
        make.top.mas_equalTo(self.contentView).offset(5 * SCREENH6);
    }];
    
    [self.adressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.mas_equalTo(self.nameLabel);
        make.bottom.mas_equalTo(self.contentView).offset(-5 * SCREENH6);
    }];
    
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(self.contentView).offset(15 * SCREENH6);
        make.trailing.mas_equalTo(self.contentView).offset(-15 * SCREENH6);
        make.bottom.mas_equalTo(self.contentView);
        make.height.mas_equalTo(1 * SCREENH6);
    }];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
